package com.rede.didiok.community;

import java.util.TimeZone;

import javax.annotation.PostConstruct;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.oas.annotations.EnableOpenApi;

import com.rede.didiok.common.utils.SpringUtils;

@EnableTransactionManagement
@EnableDiscoveryClient
@SpringBootApplication
@EnableFeignClients(basePackages = {"com.rede.didiok.common.feign"})
@EnableOpenApi
@EnableAsync
@ComponentScan(basePackages = {
		"com.rede.didiok.common.config",
		"com.rede.didiok.common.annotion",
		"com.rede.didiok.common.utils",
		"com.rede.didiok.common.executor",
		"com.rede.didiok.community",
		"com.rede.didiok.common.service",
		"com.rede.didiok.community",
})
public class DidiokCommunityApplication {

	@Bean
	public SpringUtils getSpringUtils() {
		return new SpringUtils();
	}

	public static void main(String[] args) {
		TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
		SpringApplication.run(DidiokCommunityApplication.class, args);
	}

	/**
	 * 设置时区
	 */
	@PostConstruct
	void setDefaultTimezone() {
		TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
	}

}
